<template>
  <div className="login-page">
    <div className="box">
      <div className="left">
        <img src="@/assets/决策分析平台.png" alt="">
      </div>

      <div className="form">
        <h1>Login</h1>
        <div className="username">
          <label htmlFor="username"></label>
          <input type="text" id="username" v-model="username" required placeholder="请输入账号或用户名">
        </div>
        <div className="password">
          <label htmlFor="password"></label>
          <input type="password" id="password" v-model="password" required placeholder="请输入密码">
        </div>
        <a href="#" className="forget">forget password</a>
        <div>
          <button type="submit">确定</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {ref} from 'vue';

export default {
  setup() {
    const username = ref('');
    const password = ref('');

    const login = () => {
      // 在这里处理登录逻辑，例如发送登录请求到后端服务器
      console.log('Username:', username.value);
      console.log('Password:', password.value);
    };

    return {
      username,
      password,
      login,
    };
  },
};
</script>

<style scoped>
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(to right, #65CBF7, #B3A5FC);
  background-size: cover;
}

.box {
  width: 60%;
  height: 450px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, .8);
  display: flex;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.left {
  width: 65%;
}

.left > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.form {
  width: 35%;
  height: 100%;
  box-sizing: border-box;
  background-color: #fff;;
  padding: 0 20px;
}

h1 {
  text-align: center;
  padding-top: 45px;
  margin-top: 0;
}

input[type="text"], input[type="password"] {
  height: 44px;
  padding: 0;
  padding-left: 5px;
  border: none;
  background: none;
  outline: none;
  border-bottom: 3px solid #B3A5FC;
  width: 100%;
  font-size: 18px;
  margin-top: 20px;
}

.forget {
  margin-top: 25px;
  color: #9C3493;
  text-align: right;
  display: block;
}

button {
  background: #65CBF7;
  color: #9C3493;
  font-weight: bold;
  border: none;
  border-radius: 30px;
  height: 46px;
  width: 80%;
  font-size: 18px;
  display: block;
  margin: auto;
  margin-top: 30px;
}

/* 适配PC */
@media screen and (min-width: 960px) {
  .box {
    max-width: 950px;
    min-width: 750px;
  }
}

/* 适配IPAD */
@media screen and (max-width: 960px) {
  .box {
    display: block;
    height: auto;
  }

  .left.form {
    width: 100%;
    margin-top: 0;
  }

  .left {
    height: 200px;
  }

  .form {
    padding: 2vw 2vw;
  }

  h1 {
    padding-top: 0;
    margin-bottom: 1vw;
  }

  input {
    margin-top: 2vw;
  }

  button {
    margin-top: 2vw;
  }
}

/* 适配手机 */
@media screen and (max-width: 750px) {
  .box {
    width: 85%;
  }
}
</style>

